//
//  MFWDownloadTaskRequest.h
//  download
//
//  Created by 陈曦 on 13-4-26.
//  Copyright (c) 2013年 陈曦. All rights reserved.
//


@class MFWDownloadTaskRequest;

@protocol MFWDownloadTaskRequestDelegate <NSObject>

// 缓冲区满之后 返回数据
- (void)taskRequest:(MFWDownloadTaskRequest*)aRequest
        getData:(NSData*)aData
       atOffset:(unsigned long long) aOffset;

// 完成指定length的任务
- (void)taskRequestFinished:(MFWDownloadTaskRequest*)aRequest;

// 任务失败
- (void)taskRequestFailed:  (MFWDownloadTaskRequest*)aRequest;

@end


@interface MFWDownloadTaskRequest : NSObject

@property (nonatomic, assign) unsigned long bufferSize;

@property (nonatomic, assign) unsigned long long beginOffset;
@property (nonatomic, assign) unsigned long long length;

@property (nonatomic, readonly) NSInteger retryCount;

@property (nonatomic, readonly) BOOL isRunning;

@property (nonatomic, readonly) unsigned long long unDownloadSize;

- (id)initWithUrl:(NSString*)aUrl delegate:(id<MFWDownloadTaskRequestDelegate>)aDelegate;
- (void)flush;

- (void)start;
- (void)stop;
- (void)clear;


@end